#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int arr[10][10] = { 0 };
	int n = 0;
	scanf("%d", &n);
	int i = 0, j = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	int k = 0;
	for (j = 0; j < n - 1; j++)
	{
		for (k = j + 1; k < n; k++)
		{
			if (arr[k][j] != 0)
			{
				printf("NO");
				goto OK;
			}
		}
	}
	if (j == n - 1)
		printf("YES");
OK:
	return 0;
}